import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
class Request {

  static Request _request = Request._initialize();

  factory Request(){
    return _request;
  }

  Request._initialize();

  static BaseOptions options = BaseOptions(
    baseUrl:'http://rap2.taobao.org:38080/app/mock/149003',
    connectTimeout: 30000,
    receiveTimeout: 10000,
  );

  Dio dio = Dio(options);

  Future<dynamic> get(String url, {Map<String, dynamic> queraParameters}) async {
    Response response = await dio.get(url, queryParameters: queraParameters);
    if (response.statusCode == 200) {
      return {'success': response.data};
    }else {
      return {"failure":response.data};
    }
  }
}